<html>
<head>
  <title>How To Debounce A Switch...</title>
</head>

<body>

<!-- BEGIN LAB DESCRIPTION -->

<font face="Arial">
<!------------------------------------------------------------------------------------>
<a name="HowToDebounce">
<h2>How To Debounce A Switch...</h2>
</a>

<p>A switch is a mechanical device that "opens" and "closes" a circuit.  The switches
on the eZ430X board are normally open, letting the inputs be pulled high (a logic one) by the
internal MSP430 port pull-up resistors.  A closed or depressed switch grounds
an input pin resulting in a logic zero.

<p>However, these mechanical devices do not instantly nor cleanly
change the input to your MSP430.  The value on the pin of an input port
may make multiple transitions, partial transitions with pauses, or just
change slowly when compared to the speed of the microcontroller.
If software does not handle this transition properly, multiple transitions
could be registered, which would be interpreted as the switch being pressed
or released multiple times - very annoying at best!

<p>The transition time of a switch (before it becomes stable) could vary
wildly from 1 to 50 ms, depending on the type and action of the switch.
Although the type of switch used on the MSP430 is very clean and almost
instantaneous during the press, the release is another matter.

<p>To debounce a switch, make sure that the frequency of the sampling of a switch is
sufficiently long enough to allow for the input to the microcontroller to settle.

<p>See Switch Debounce:	MMB pgs. 225-238.

<!-- END LAB DESCRIPTION -->

</body>
</html>

